#!/usr/bin/env bash

PASSWORD="123456"

for pm in "$@"; do
  case "$pm" in
    --password=*)
      PASSWORD="${pm#*=}";;
    *)
    ;;
  esac
done

echo -e "$PASSWORD\n$PASSWORD\n"|vncserver
cat << \EOF >~/.vnc/xstartup
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
startxfce4 &
EOF
